<template>
  <div class="main">
    <section class="section1">
      <a
        href="javascript:;"
        v-for="({ imgName, imgUrl }, i) in navList"
        :key="i + 'nav'"
      >
        {{ item }}
        <div>
          <img
            :src="imgUrl"
            :alt="imgName"
          />
        </div>
        <p>新品首发</p>
      </a>
    </section>
    <!-- ============================= 新品首发 End =================================== -->

    <section class="section2">
      <a href="javascript:;">
        <img
          src="http://cba.itlike.com/public/uploads/10001/20230320/647c6bde4b1f1a3e88955e5f596344f9.png"
          alt=""
        />
      </a>
    </section>

    <section class="section3">
      <h2>——&nbsp;&nbsp;猜你喜欢&nbsp;&nbsp;——</h2>

      <!-- ============================= 商品组 Start =================================== -->
      <ul class="section3Ul">
        <li
          v-for="(item, i) in goodsList"
          :key="i + 'goods'"
        >
          <a href="javascript:;">
            <img
              :src="item.goods_image"
              alt=""
            />
            <div class="goodCont">
              <h3>{{ item.goods_name }}</h3>
              <p class="selled">已售{{ item.goods_sales }}件</p>
              <p class="price">
                ¥{{ item.line_price_min }}<span>¥{{ item.line_price_max }}</span>
              </p>
            </div>
          </a>
        </li>
      </ul>
      <!-- ============================= 商品组 Start =================================== -->
    </section>
  </div>
</template>

<script>
export default {
  name: 'my-main',
  props: {
    goodsList: {
      type: Array,
      default() {
        return []
      },
    },
    navList: {
      type: Array,
      default() {
        return []
      },
    },
  },
}
</script>

<style lang="less" scoped>
.main {
  padding-bottom: 50px;
  .section1 {
    background-color: #fff;
    padding-top: 4.5333vw;
    padding-left: 4.2667vw;
    padding-right: 4.2667vw;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    justify-content: space-around;
    text-align: center;
    a {
      width: 20%;
      div {
        display: flex;
        align-items: center;
        justify-content: space-between;
        justify-content: center;
        margin: 0 auto;
        width: 10.6667vw;
        height: 10.6667vw;
        .iconfont {
          font-size: 5.3333vw;
          color: #fff;
        }
      }
      p {
        margin-top: 2.6667vw;
        margin-bottom: 4.5333vw;
        font-size: 3.4667vw;
      }
    }
  }
  .section2 {
    img {
      width: 100%;
    }
  }
  .section3 {
    h2 {
      background-color: #fff;
      line-height: 8vw;
      text-align: center;
      padding: 1.3333vw 0;
      font-size: 3.7333vw;
      font-weight: normal;
      margin-bottom: 0.5333vw;
    }
    ul {
      li {
        padding: 10px;
        margin-bottom: 1.6vw;
        background-color: #fff;
        a {
          display: flex;
          align-items: center;
          justify-content: space-between;
          img {
            width: 32vw;
          }
          .goodCont {
            width: 60%;
          }
          .goodCont {
            h3 {
              margin-top: 2.6667vw;
              min-height: 9.0667vw;
              line-height: 1.3;
              white-space: normal;
              color: #484848;
              font-size: 3.4667vw;
              font-weight: normal;
              overflow: hidden;
              text-overflow: ellipsis;
              display: -webkit-box;
              -webkit-box-orient: vertical;
              -webkit-line-clamp: 2;
            }
            .selled {
              color: #999;
              font-size: 3.2vw;
              margin: 1.0667vw 0;
            }
            .price {
              margin-right: 2.1333vw;
              color: #f03c3c;
              font-size: 4vw;
              span {
                color: #999;
                text-decoration: line-through;
              }
            }
          }
        }
      }
    }
  }
}
</style>
